<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateShopDataExpressTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $table = $this->table('shop_data_express', ['comment' => '快递公司', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci']);
        $table->addColumn('name', 'string', ['limit' =>  255, 'default' => '', 'comment' => '快递公司'])
            ->addColumn('code', 'string', ['limit' => 60, 'null' => true, 'default' => null, 'comment' => '公司编号'])
            ->addColumn('weigh', 'integer', ['limit'  =>  8, 'default' => 0, 'comment' => '权重'])
            ->addIndex('code')
            ->create();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $table = $this->table('shop_data_express');
        $table->drop();
    }
}
